<template>
  <el-dialog title="踢回公海" :visible.sync="open" append-to-body>
    <el-form :model="form" label-width="80px">
   <el-row>
     <el-col :span="24">
       <el-form-item label="原因" prop="record">
         <el-select v-model="form.record" placeholder="请选择原因">
           <el-option v-for="dict in dict.type.reasons_for_business_reporting" :label="dict.label" :value="dict.value" :key="dict.value">

           </el-option>
         </el-select>

       </el-form-item>
     </el-col>
   </el-row>
    </el-form>
    <div slot="footer" class="dialog-foot">
      <el-button @click="open=false">取消</el-button>
      <el-button type="primary" @click="submitForm">确定</el-button>
    </div>
  </el-dialog>
</template>
<script>
  import {givaBackBusiness} from "@/api/crm/businessTrack"

    export default {
        name: "give-back",
        dicts:['reasons_for_business_reporting'],
      props:['businessId'],
      data(){
          return{
            open:false,
            form:{},
          }
      },
      methods: {
        submitForm(){
          this.$refs.form.validate(valid=>{
            if(valid){
              this.form.id=this.businessId
              givaBackBusiness(this.businessId,this.form).then(()=>{
                this.$model.msgSuccess('操作成功');
                this.$emit('success')
              })
              .catch(()=>this.$modal.msgError('操作失败'))
              this.open=false;
            }
          })
        }
      },
      created() {

      }
    }
</script>

<style scoped>

</style>
